package com.jsmile.cloud.tradecenter.api.feign;

import javax.validation.Valid;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.jsmile.cloud.tradecenter.api.constants.TradeConstants;
import com.jsmile.cloud.tradecenter.api.req.ReqOrderCreate;
import com.jsmile.cloud.tradecenter.api.req.ReqOrderFinish;
import com.jsmile.cloud.tradecenter.api.req.ReqOrderRefund;
import com.jsmile.cloud.tradecenter.api.req.ReqPayOrder;
import com.jsmile.cloud.tradecenter.api.res.ResOrderList;
import com.jsmile.mall.api.JSmileResult;

@FeignClient(value = TradeConstants.APPLICATION_NAME, contextId = "order")
public interface OrderServiceApi {

    // TODO 创建订单
    @RequestMapping(value = "/feign/order/create", method = RequestMethod.POST)
    JSmileResult<ResOrderList> create(@RequestBody @Valid ReqOrderCreate reqOrderCreate);

    // TODO 订单预览
    @RequestMapping(value = "/feign/order/preview", method = RequestMethod.POST)
    JSmileResult<ResOrderList> preview(@RequestBody @Valid ReqOrderCreate reqOrderCreate);

    // TODO 订单支付成功
    @RequestMapping(value = "/feign/order/paySuccess", method = RequestMethod.POST)
    JSmileResult paySuccess(@RequestBody @Valid ReqPayOrder reqOrderPay);

    // TODO 订单去支付
    @RequestMapping(value = "/feign/order/toPay", method = RequestMethod.POST)
    JSmileResult toPay(@RequestBody @Valid ReqPayOrder reqPayOrder);

    // TODO 订单支付成功
    @RequestMapping(value = "/feign/order/finish", method = RequestMethod.POST)
    JSmileResult finish(@RequestBody @Valid ReqOrderFinish reqOrderFinish);

    // TODO 订单退款
    @RequestMapping(value = "/feign/order/refund", method = RequestMethod.POST)
    JSmileResult refund(@RequestBody @Valid ReqOrderRefund reqOrderRefund);
}
